package org.example.erp.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * @TableName equipment
 */
@TableName(value = "equipment")
@Data
public class Equipment implements Serializable {
    /**
     * 设备编码,主键不自增
     */
    @TableId
    private String deviceNo;

    /**
     * 设备名称
     */
    private String deviceName;

    /**
     * 品牌
     */
    private String brand;

    /**
     * 规格型号
     */
    private String specificationModel;

    /**
     * 所属车间 ,外键（关联车间表）
     */
    private String workshopId;

    /**
     * 设备状态
     */
    private String deviceStatus;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    /**
     * 所属设备类型
     */
    private String deviceTypeId;

    /**
     * 备注
     */
    private String remark;

    /**
     * 备用列1
     */
    private String columnOne;

    /**
     * 备用列2
     */
    private String columeTwo;

    /**
     * 备用列3
     */
    private String columeThree;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Workshop workshop;
    @TableField(exist = false)
    private DeviceType deviceType;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Equipment other = (Equipment) that;
        return (this.getDeviceNo() == null ? other.getDeviceNo() == null : this.getDeviceNo().equals(other.getDeviceNo()))
                && (this.getDeviceName() == null ? other.getDeviceName() == null : this.getDeviceName().equals(other.getDeviceName()))
                && (this.getBrand() == null ? other.getBrand() == null : this.getBrand().equals(other.getBrand()))
                && (this.getSpecificationModel() == null ? other.getSpecificationModel() == null : this.getSpecificationModel().equals(other.getSpecificationModel()))
                && (this.getWorkshopId() == null ? other.getWorkshopId() == null : this.getWorkshopId().equals(other.getWorkshopId()))
                && (this.getDeviceStatus() == null ? other.getDeviceStatus() == null : this.getDeviceStatus().equals(other.getDeviceStatus()))
                && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
                && (this.getDeviceTypeId() == null ? other.getDeviceTypeId() == null : this.getDeviceTypeId().equals(other.getDeviceTypeId()))
                && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
                && (this.getColumnOne() == null ? other.getColumnOne() == null : this.getColumnOne().equals(other.getColumnOne()))
                && (this.getColumeTwo() == null ? other.getColumeTwo() == null : this.getColumeTwo().equals(other.getColumeTwo()))
                && (this.getColumeThree() == null ? other.getColumeThree() == null : this.getColumeThree().equals(other.getColumeThree()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getDeviceNo() == null) ? 0 : getDeviceNo().hashCode());
        result = prime * result + ((getDeviceName() == null) ? 0 : getDeviceName().hashCode());
        result = prime * result + ((getBrand() == null) ? 0 : getBrand().hashCode());
        result = prime * result + ((getSpecificationModel() == null) ? 0 : getSpecificationModel().hashCode());
        result = prime * result + ((getWorkshopId() == null) ? 0 : getWorkshopId().hashCode());
        result = prime * result + ((getDeviceStatus() == null) ? 0 : getDeviceStatus().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getDeviceTypeId() == null) ? 0 : getDeviceTypeId().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getColumnOne() == null) ? 0 : getColumnOne().hashCode());
        result = prime * result + ((getColumeTwo() == null) ? 0 : getColumeTwo().hashCode());
        result = prime * result + ((getColumeThree() == null) ? 0 : getColumeThree().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", deviceNo=").append(deviceNo);
        sb.append(", deviceName=").append(deviceName);
        sb.append(", brand=").append(brand);
        sb.append(", specificationModel=").append(specificationModel);
        sb.append(", workshopId=").append(workshopId);
        sb.append(", deviceStatus=").append(deviceStatus);
        sb.append(", createTime=").append(createTime);
        sb.append(", deviceTypeId=").append(deviceTypeId);
        sb.append(", remark=").append(remark);
        sb.append(", columnOne=").append(columnOne);
        sb.append(", columeTwo=").append(columeTwo);
        sb.append(", columeThree=").append(columeThree);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}